package com.sky.controller.admin;

import com.sky.dto.DataQueryDTO;
import com.sky.result.Result;
import com.sky.server.ReportService;
import com.sky.vo.OrderReportVO;
import com.sky.vo.TurnoverReportVO;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

@RestController()
@Slf4j
@RequestMapping("/admin/report")
public class ReportController {
    @Resource(name = "ReportServiceImpl0")
    private ReportService reportService;
    @GetMapping("/turnoverStatistics")
    public Result<TurnoverReportVO> turnoverReport(DataQueryDTO dataQueryDTO){
        log.info("********************请求携带的参数:{}",dataQueryDTO);
        TurnoverReportVO turnoverReportVO = reportService.turnoverReport(dataQueryDTO);
        log.info("****************turnoverReportVO:{}",turnoverReportVO);
        return Result.success(turnoverReportVO);
    }
    @GetMapping("/ordersStatistics")
    public Result<OrderReportVO> ordersReport(DataQueryDTO dataQueryDTO){
        log.info("*****************请求携带的参数:{}",dataQueryDTO);
        OrderReportVO orderReportVO = reportService.ordersReport(dataQueryDTO);
        log.info("********************返回的数据:{}",orderReportVO);
        return Result.success(orderReportVO);
    }

}
